{% extends "base.html" %}


{% block menu %}

 <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="brand" href="#">Project Manager System</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li class="active"><a href="">Administrar Solicitud</a></li>
              <li><a href="/">Logout</a></li>
              <li><a href="#contact">Usuario: {{session['username']}}</a></li>
              </ul>
          </div>
         </div>
        </div>
</div>
              
{%endblock%}


{%block content%}
<div class="fases">
		<div class="container" align="center">
        <h3 class="muted">{{session['proyectonombre']}}</h3>
        </div>
        {% with messages = get_flashed_messages(with_categories=true) %}
          {% if messages %}
          <div class="container" align="center">
            {% for category, message in messages %}
              <h4 class="{{ category }}">{{ message }}</h4>
            {% endfor %}
                  </div>
          {% endif %}
        {% endwith %}
        <div class="row" >
                <div class="span12">
                        <h2> Listado de Items de Solicitud de Cambio </h2>
                      
                        <table class="table table-striped table-bordered">
                                <tr>
                                        <th>Nombre</th>
                                        <th>Estado</th>
				                        <th>Tipo</th>
				                        <th>Version</th>
				                        {% if accionHabilitada(s,"Editar") %}
				                        <th>Atributos</th>
				                        <th>Editar</th>
				                        {%endif%}
				                        {% if accionHabilitada(s,"Eliminar") %}
				                        <th>Eliminar</th>
				                        {%endif%}
				                        <th>Consultar</th>
				                        {%if accionHabilitada(s,"Crear Relacion")%}
				                        <th>Asignar</th>
				                        <th>Asignar</th>
				                        {%endif%}
				                        {%if accionHabilitada(s,"Eliminar Relacion")%}
				                        <th>Relaciones</th>
				                        {%endif%}
										
                                </tr>
                                {% for i in s.items %}
                    
                                <tr>
                                		
                                        <td>{{i.item.nombre}}</td>
                                        <td>{{i.item.estado}}</td>
                                        <td>{{i.item.item.tipoitem.nombre}}</td>
                                        <td>{{i.item.version}}</td>
                                        {% if accionHabilitada(s,"Editar")%}
	                                    <td>
	                                    
                                        {% if i.item.item.tipoitem.atributos and i.item.estado!="Eliminado" %}
                                        	<a class="btn" href="/admsolicitud/ejecutar/atributo/{{i.item.id}}">Completar</a>
                                        {% else %}
                                        	No tiene Atributos
                                        {%endif%}
                                        </td>
                                        <td>
                                        {%if i.item.estado!="Eliminado"%}
                                        <a class="btn" href="/admsolicitud/ejecutar/editaritem/{{i.item.id}}">Editar</a>
                                        {%endif%}
                                        </td>
                                        {%endif%}
                                        {% if accionHabilitada(s,"Eliminar")%}
		                                <td>
		                                {%if i.item.estado!="Eliminado"%}
		                                <a class="btn btn-danger" href="/admsolicitud/ejecutar/eliminaritem/{{i.item.id}}">Eliminar</a>
		                                {%endif%}
                                        </td>
                                        {%endif%}
                                        <td>
                                        <a class="btn btn-info" href="/admitem/consultaritem/{{i.item.id}}">Consultar</a>
                                        </td>
                                        {%if accionHabilitada(s,"Crear Relacion") %}
                                        <td>
                                        {%if i.item.estado!="Eliminado"%}
                                        <a class="btn btn-warning" href="/admsolicitud/ejecutar/asignarpadre/{{i.item.id}}">Padre</a>
                                        {%endif%}
                                        </td>
                                        <td>
                                        {%if i.item.estado!="Eliminado"%}
                                        <a class="btn btn-warning" href="/admsolicitud/ejecutar/asignarante/{{i.item.id}}">Antecesor</a>
                                        {%endif%}
                                        </td>
                                        
                                        {%endif%}
                                        {%if accionHabilitada(s,"Eliminar Relacion")%}
                                        <td>
                                        {%if i.item.estado!="Eliminado"%}
                                        <a class="btn btn-inverse" href="/admsolicitud/ejecutar/eliminarrel/{{i.item.id}}">Eliminar</a>
                                        {%endif%}
                                        </td>
                                        {%endif%}
                                       
                        </tr>
                                {% else %}
                        
                                <tr>
                                        No se han creado items aún
                                </tr>
                                {% endfor %}
                </table>
                <a class="btn" href="/admsolicitud/"><i class="icon-arrow-left"></i> Atras</a>
      	  </div>
	      	  <div class="span3 bs-docs-sidebar" >
	        	<ul class="nav nav-list bs-docs-sidenav">
						  <li><a href="/admsolicitud/terminar/{{session['solicitudid']}}"><i class="icon-chevron-right"></i>Terminar</a></li>
					</ul>
			</div>
      	  
      </div>
</div>
{%endblock%} 
